package com.mm.enums;

/**
 * API 统一返回状态码
 */
public enum ResultCodeEnum {

    SUCCESS(200,"成功"),
    FAIL(-1,"失败"),
    /**
     * 系统异常 500 服务器的内部错误
     */
    SERVER_ERROR(500, "服务器开小差，请稍后再试"),

    /**
     * 系统限流
     */
    TRAFFIC_LIMITING(429, "哎呀，网络拥挤请稍后再试试"),
    /**
     * 权限异常
     */
    NOT_PERMISSIONS(401,"您没有操作权限"),
    BODY_NOT_MATCH(400,"请求的数据格式不符!"),
    NOT_FOUND(404, "未找到该资源!"),
    SERVER_BUSY(503,"服务器正忙，请稍后再试!"),
    SYSTREM_ERROR(9000, "系统错误"),
    VALIDATE_ERROR(9001, "参数验证失败"),
    FIELD_INVALID(9002, "登录失败"),
    SAVE_ERROR(9003, "数据添加失败"),
    NOT_LOGIN(9004, "用户未登录"),
    JWT_TOKEN_EXPIRED(9005, "登录过期"),
    JWT_TOKEN_SIGNATURE_ERROR(9006, "签名错误"),
    JWT_TOKEN_ERROR(9007, "登录错误，请重新登录"),
    NO_MORE_DATA(9008, "没有更多数据了"),
    NO_DATA(9009, "数据不存在"),
    NO_MEMBER(9011, "用户不存在，请重新登录"),
    UNAUTHENTIC(10000, "请先登录！"),
    UNAUTHORIZED(10001, "没有权限访问！"),
    USERNAME_ERROR(10002,"账号或密码错误"),
    NO_USERNAME(10002,"账号不存在"),
    ADD(10003,"新增失败"),
    UPDATE(10004,"编辑失败"),
    DELETE(10004,"删除失败"),
    DATA_EXIST(9010, "数据已存在");


    private Integer code;

    private String message;

    ResultCodeEnum(Integer code, String message) {
        this.code = code;
        this.message = message;
    }

    public Integer getCode(){
        return this.code;
    }

    public String getMessage(){
        return this.message;
    }
}
